#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

void Yanghuisanjiao(int arr[5][5], int n)
{
	int i = 0;
	int j = 0;
	for (i = 0; i < 5; i++)
	{
		for (j = 0; j <= i; j++)
		{
			if (j == 0 || j == i)
			{
				arr[i][j] = 1;
			}
			else
			{
				arr[i][j] = arr[i - 1][j] + arr[i - 1][j - 1];
			}
		}
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j <=i ;j++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
}

int main()
{
	int n = 5;
	int arr[5][5] = { 0 };
	Yanghuisanjiao(arr,n);

	return 0;
}
